1. Field of the Invention
The present invention relates to an image processing apparatus, image processing method, and computer-readable medium which perform image data compression processing of compressing an image for each predetermined block, image processing for the data compressed for each predetermined block, and processing of restoring the processed data to the original image data.
2. Description of the Related Art
High-resolution color images have conventionally been in high demand. To meet the demands to improve image quality, it is becoming a common practice to process, by a digital multi-functional peripheral, images with resolutions of 1,200 dpi (dots per inch) or more. To save space on a memory/hard disk and to shorten the time taken to write data on it, not only a digital multi-functional peripheral but also image processing apparatuses (digital camera and facsimile apparatus) which process these images compress color image data to achieve a cost reduction and a speedup. Among color still image compression schemes, a JPEG scheme which uses discrete cosine transformation and a scheme which uses wavelet transformation have been widely and conventionally employed.
With an increase in resolution, the number of pixels which require image processing has dramatically increased, so the processing load is becoming increasing. For example, upon doubling the resolution from 600 dpi to 1,200 dpi, the number of pixels to be processed quadruples. When the above-mentioned image compression is employed, processing of decoding the compressed data becomes necessary to refer to and convert the pixel data with the doubled resolution. In other words, image processing cannot be performed for the compressed data intact, so its decoding processing inevitably becomes necessary. This makes it necessary to process all pixels in the high-resolution data for each pixel, thus prolonging the processing time.
As techniques of compressing pixel data, a known run-length compression scheme of storing a plurality of pixel data and their runs, and a technique (see, for example, Japanese Patent Laid-Open No. 10-257488) of compressing pixel data by detecting an edge for each block and storing two colors of this edge, for example, have been disclosed.
Also, in Japanese Patent Laid-Open No. 2007-143082, image data having undergone pseudo halftone processing using a dither pattern is divided into predetermined blocks to generate compressed data using the array pattern, representative value, and position data of the image data within each block. With this proposed method, the compression effect is enhanced. As a method of encoding an image having a mixture of, for example, a text and a photo, histograms are obtained for R, G, and B, respectively, of data in each block. A block with a histogram which exhibits distribution characteristics having two peaks is determined as a two-color region, and that with a dispersed histogram is determined as a multilevel region, thereby performing encoding using an encoding scheme suitable for the characteristics of each block.
In Japanese Patent Laid-Open No. 7-236062, a histogram is obtained for image data, and it is determined based on the histogram whether the image data is a region of a text/line image or nature image. With this proposed method, the compression ratio is improved while maintaining a given image quality by changing the encoding method in accordance with the determination result.
The compression scheme to compress image data for each block can compress it at a higher compression ratio as the number of colors in a region obtained by block division decreases or the same pattern continues longer. Conversely, it is difficult to compress an image (FIG. 19A) such as a nature image that contains a large amount of edge information at a high compression ratio.
On the other hand, image data having undergone pseudo halftone processing has a smaller number of gray levels than multiple gray-level image data, and therefore can be compressed at a relatively high compression ratio even if it represents an image such as a nature image containing a large amount of edge information. FIG. 19B shows multiple gray-level image data obtained by enlarging a portion 1900 shown in FIG. 19A, and FIG. 19C shows image data obtained by performing pseudo halftone processing of the portion 1900 shown in FIG. 19A. Obviously, the data shown in FIG. 19C has coarser pixels and therefore has a smaller amount of information than that shown in FIG. 19B. However, in data in which the halftone density continues (for example, data in which gray continues alone), such as a halftone text, the number of colors increases upon dither processing, thus lowering the compression ratio. As can be seen from a comparison between a portion 2000 shown in FIG. 19B and a portion 2100 shown in FIG. 19C, pixels with the same density continue longer in the former than in the latter.